﻿@{
    ViewBag.Title = "Dashboard - Project Management System";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
    Notifications</h2>
<form id="form" action="" method="post" enctype="multipart/form-data">
<div class="content-box">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>
            Notifications</h3>
        <div class="clear">
        </div>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        <div>
            <!-- This is the target div. id must match the href of this div's tab -->
            @{ if (TempData["Message"] != null)
               {
                <div class="notification attention png_bg">
                    <a href="#" class="close">
                        <img src="../../Content/images/icons/cross_grey_small.png" title="Close this notification"
                            alt="close" /></a>
                    <div>
                        @TempData["Message"].ToString()
                    </div>
                </div>
               }
            }
            @{ 
                var pageSize = int.Parse(ViewData[PMS.ENT.PageInfo.PageSize.ToString()].ToString());
                var pageNum = int.Parse(ViewData[PMS.ENT.PageInfo.PageNum.ToString()].ToString());
                var page = int.Parse(ViewData[PMS.ENT.PageInfo.Page.ToString()].ToString()); }
            <input type="hidden" name="NotificationID" id="NotificationID" />
            <input type="hidden" name="Action" id="Action" />
            <input type="hidden" value="@ViewData["OrderBy"]" name="orderBy" id="orderBy" />
            <input type="hidden" value="@ViewData["OrderDirection"]" name="orderDirection"
                id="orderDirection" />
            @{if (Model.Count <= 0)
              {
                <div class="RecordFound @("RecordFound" + @Model.Count)">
                    No Record Found</div>
              }
            }
            @{ for (int i = 0; i < Model.Count; i++)
               {
                   if (Model[i].IsRead == 0)
                   {
                <div onclick="GotoPage(@Model[i].NotificationID)" style="cursor:pointer; background-color: #CCCCCC; padding-left: 10px" title="tin chưa đọc">
                    <p style="border-bottom: 1px dotted">
                        <span style="color: Blue">@Model[i].Description</span>
                        <br clear="all" />
                        <span style="font-size: smaller">@Model[i].CreatedDate.ToString("dd/MM//yyyy hh:mm:ss")</span></p>
                </div>
                   }
                   else
                   {
                <div onclick="GotoPage(@Model[i].NotificationID)" style="cursor:pointer;background-color: #ffffff; padding-left: 10px">
                    <p style="border-bottom: 1px dotted">
                        <span style="color: Blue">@Model[i].Description</span>
                        <br clear="all" />
                        @Model[i].CreatedDate</p>
                </div>
                   }
               } }
            @{Html.RenderPartial("Pagination", null, ViewData); }
        </div>
        <!-- End #tab1 -->
    </div>
    <!-- End .content-box-content -->
</div>
</form>
<script type="text/javascript">
    $("#Dashboard").addClass("current");

    function GotoPage(notificationID) {
        $("#NotificationID").val(notificationID);
        $("#Action").val('GotoPage');
        form.submit();
    }

</script>
